import java.util.*;

public class Leet282 {
    List<String> list = new ArrayList<>();

    public static void main(String[] args) {
        Leet282 l = new Leet282();
        System.out.println(l.addOperators("9999999999",1409865409));
    }
    public List<String> addOperators(String num, int target) {
        list = new ArrayList<>();
        dfs(num,new Stack<>(), target);
        try {
            if (target!=0&&target==Integer.parseInt(num))
                list.add(num);
        }catch (Exception e){
        }
        return list;
    }
    void dfs(String str, Stack<String> stack, int target){
        if (str.length()==0){
            if (stack.size()==1)
                return;
            long re = 0;
            Stack<String> stack1 = new Stack<>();
            stack1.addAll(stack);
            while (stack1.size()>2){
                long t1 = Long.parseLong(stack1.pop());
                char c = stack1.pop().charAt(0);
                if (c=='*'){
                    stack1.push(String.valueOf(t1*Long.parseLong(stack1.pop())));
                }else if (c=='+'){
                    re+=t1;
                }else if (c=='-'){
                    re-=t1;
                }
            }
            re+=Long.parseLong(stack1.pop());
            if (re==target){
                System.out.println(re);
                StringBuilder sb = new StringBuilder();
                for (String s : stack) {
                    sb.append(s);
                }
                list.add(sb.toString());
            }
               return;
        }
        if (stack.isEmpty()||Objects.equals(stack.peek(), "+")||Objects.equals(stack.peek(), "-")||Objects.equals(stack.peek(), "*")){
            if (str.charAt(0)=='0'){
                stack.push(str.substring(0,1));
                dfs(str.substring(1),stack,target);
                stack.pop();
            }
            else
                for (int i = 1; i < str.length()+1; i++) {
                    stack.push(str.substring(0,i));
                    dfs(str.substring(i),stack,target);
                    stack.pop();
                }
        }else {
            stack.push("+");
            dfs(str,stack,target);
            stack.pop();
            stack.push("-");
            dfs(str,stack,target);
            stack.pop();
            stack.push("*");
            dfs(str,stack,target);
            stack.pop();
        }
    }
}
